home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ARASAN_S.ZIP / UTIL.H < prev    next >
C/C++ Source or Header  |  1994-02-19  |  591b  |  38 lines

  1. // Copyright 1994 by Jon Dart.  All Rights Reserved.
  2.  
  3. #ifndef _UTIL_H
  4. #define _UTIL_H
  5.  
  6. class Util
  7.     // commonly used utility functions
  8.         
  9.     public:    
  10.     
  11.     static int Abs( const int x )
  12.     {
  13.      return (x < 0) ? -x : x;    
  14.     }
  15.     
  16.     static int Sign( const int x )
  17.     {
  18.      if (x==0)
  19.          return 0;
  20.      else
  21.          return (x > 0) ? 1 : -1;
  22.     }
  23.     
  24.     static int Max( const int x, const int y )
  25.     {
  26.     return (x > y) ? x : y;    
  27.     }
  28.   
  29.     static int Min( const int x, const int y )
  30.     {
  31.     return (x > y) ? y : x;    
  32.     }
  33.   
  34. };
  35.  
  36. #endif
  37.